#ifndef __BASIC_JSON_CPP_UTILS_H__
#define __BASIC_JSON_CPP_UTILS_H__

#include "types.h"
#include "../../../../external/jsoncpp/include/json/json.h"

template <typename T>
inline void gFetchJsonValue(const Json::Value& v, const dks& key, T* out);
template <typename dkint>
inline void gFetchJsonValue(const Json::Value& v, const dks& key, dkint* out) {
  *out = v[key].asInt();
}
template <typename dks>
inline void gFetchJsonValue(const Json::Value& v, const dks& key, dks* out) {
  *out = v[key].asString();
}
template <typename dkbool>
inline void gFetchJsonValue(const Json::Value& v, const dks& key, dkbool* out) {
  *out = v[key].asBool();
}

template <typename T>
inline void gFetchJsonValue(const Json::Value& v, const dkc* key, T* out);
template <typename dkint>
inline void gFetchJsonValue(const Json::Value& v, const dkc* key, dkint* out) {
  *out = v[key].asInt();
}
template <typename dks>
inline void gFetchJsonValue(const Json::Value& v, const dkc*& key, dks* out) {
  *out = v[key].asString();
}
template <typename dkbool>
inline void gFetchJsonValue(const Json::Value& v, const dkc*& key,
                            dkbool* out) {
  *out = v[key].asBool();
}

#endif
